package org.yx.service.sbas.view_warehouse_definition;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SbasStoDef;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查看仓库定义信息
 * 
 * @author zxw
 * @since 2019/04/15
 **/
public class SbasViewWarehouseDefinitionService extends BaseService {
	public SbasViewWarehouseDefinitionOut viewWarehouseDefinition(SbasViewWarehouseDefinitionIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("orgCode", in.getUserOrgCode());
		query.addFilter("whStatus", "<>", 'D');
		if (StrUtil.isNotBlank(in.getWhCode())) {
			query.addFilter("whCode", in.getWhCode());
		}

		Page<SbasStoDef> pageStore = selectPage(SbasStoDef.class, query);

		SbasViewWarehouseDefinitionOut out = new SbasViewWarehouseDefinitionOut();
		out.setStoreList(pageStore.getList());
		out.setTotal(pageStore.getTotalSize());

		return out;
	}
}